package com.example.mybatisplusdemo.controller;

import com.example.mybatisplusdemo.entity.User;
import com.example.mybatisplusdemo.enums.SexEnum;
import com.example.mybatisplusdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 江黎
 * @since 2022-11-10
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping
    public List<User> getUserList() {
        return userService.list();
    }

    @PostMapping
    public void save(@RequestBody User user) {
        userService.save(user);
    }

}
